package mutsumimod.cards.copy;

import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.helpers.CardLibrary;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import mutsumimod.cards.BaseCard;
import mutsumimod.character.Mutsumi;
import mutsumimod.util.CardStats;
import mutsumimod.util.tags.CustomTags;

import java.util.ArrayList;
import java.util.Arrays;

public class FakePlay extends BaseCard  {
    public static final String ID = makeID(FakePlay.class.getSimpleName());
    public static final CardStats info = new CardStats(
            Mutsumi.Meta.CARD_COLOR,
            CardType.SKILL,
            CardRarity.UNCOMMON,
            CardTarget.SELF,
            1
    );

    public FakePlay() {
        super(ID, info);
        setAttr(0,0,0);
        setAttrUpg(0,0,0);
        originShouldCopyUse = true;
        setShouldCopyUse(true);
        tags.add(CustomTags.SELF_CARD);
    }

    @Override
    public void beforeCopy(){
        clearCopyCards();
        for(CardLibrary.LibraryType type : Arrays.asList(CardLibrary.LibraryType.RED,CardLibrary.LibraryType.GREEN,CardLibrary.LibraryType.PURPLE)) {
            ArrayList<AbstractCard> cards = CardLibrary.getCardList(type);
            if(!cards.isEmpty()) {
                AbstractCard card = cards.get(AbstractDungeon.cardRng.random(0,cards.size()-1));
                addCopyCards(card);
            }
        }
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
    }

    @Override
    public AbstractCard makeCopy() { //Optional
        return new FakePlay();
    }

    @Override
    public void updateDescription() {
        if(upgraded){
            this.rawDescription=cardStrings.UPGRADE_DESCRIPTION;
        }else{
            this.rawDescription=cardStrings.DESCRIPTION;
        }
        initializeDescription();
    }



}